package com.hulk.ratel.common.exception;

import com.hulk.ratel.common.constant.enums.BussErrCode;
import lombok.extern.slf4j.Slf4j;

/**
 * cmt
 */
@Slf4j
public class ServiceRteException extends BaseRteException {


	private static final long serialVersionUID = 1L;


	/**
	 * @param errorCode
	 * @param errorMessage
	 */
	public ServiceRteException(String intTxnSeq, int errorCode, String errorMessage) {
		super(errorCode, errorMessage);
		this.intTxnSeq = intTxnSeq;
		log.error("intTxnSeq:{},errorCode:{},errorMessage:{}", new Object[] {
				intTxnSeq, errorCode, errorMessage });
	}

	/**
	 * @param errorCode
	 * @param throwable
	 */
	@Deprecated
	public ServiceRteException(String intTxnSeq, int errorCode, Throwable throwable) {
		super(errorCode, throwable);
		this.intTxnSeq = intTxnSeq;
		log.error("intTxnSeq:{},errorCode:{},throwable:{}", new Object[] {
				intTxnSeq, errorCode, throwable.getMessage() });
	}

	/**
	 * @param errorCode
	 * @param errorMessage
	 * @param throwable
	 */
	public ServiceRteException(String intTxnSeq, int errorCode, String errorMessage,
                               Throwable throwable) {
		super(errorCode, errorMessage, throwable);
		this.intTxnSeq = intTxnSeq;
		log.error(
				"intTxnSeq:{},errorCode:{},errorMessage:{},throwable:{}",
				new Object[] { intTxnSeq, errorCode, errorMessage,
						throwable.getMessage() });
	}
	public ServiceRteException(String intTxnSeq, BussErrCode bussErrCode) {
		super(bussErrCode.getErrCode(), bussErrCode.getErrDesc());
		this.intTxnSeq = intTxnSeq;
		log.error("intTxnSeq:{},errorCode:{},errorMessage:{}", new Object[] {
				intTxnSeq, bussErrCode.getErrCode(), bussErrCode.getErrDesc() });
	}

	public ServiceRteException(String intTxnSeq, BussErrCode bussErrCode, Throwable throwable) {
		super(bussErrCode.getErrCode(), bussErrCode.getErrDesc(),throwable);
		this.intTxnSeq = intTxnSeq;
		log.error(
				"intTxnSeq:{},errorCode:{},errorMessage:{},throwable:{}",
				new Object[] { intTxnSeq, bussErrCode.getErrCode(), bussErrCode.getErrDesc(),
						throwable.getMessage() });
	}
}
